﻿<%@ Control Language="C#" %>
<%@ Register Assembly="Antu.WebControls" Namespace="Antu.WebControls" TagPrefix="CBW" %>
<style>
    .workflowtop
    {
        font-size: 12px;
        color: white;
    }
    .workflowtop td
    {
        color: white;
    }
    .workflowtop td img
    {
        cursor: pointer;
    }
</style>
<asp:Literal ID="showtreejs" runat="server"></asp:Literal>

<script type="text/javascript">

    var tab = null;
    var accordion = null;
    var tree = null;
    var dialog = null;
    var indexdata = [];
    $(function() {
        /*布局*/
        $("#layout1").ligerLayout({ leftWidth: 200, height: '100%', space: 4, onHeightChanged: f_heightChanged });
        var height = $(".l-layout-center").height();
        $("#framecenter").ligerTab({
            height: height, onAfterSelectTabItem: function(tabid) {
                t_selectNode(tabid);
            }
        });
        $("#accordion1").ligerAccordion({ height: height - 24, speed: null });
        $(".l-link").hover(function() {
            $(this).addClass("l-link-over");
        }, function() {
            $(this).removeClass("l-link-over");
        });
        tab = $("#framecenter").ligerGetTabManager();
        accordion = $("#accordion1").ligerGetAccordionManager();
        inittree();
        $("#pageloading").hide();
        Initcy();
    });

function CloseTab(){
    tab.removeSelectedTabItem();
}
    function inittree() {
        antuajax.WorkFlowHandlerSkin.gettree("<%=base.Page.Request["iid"]%>","<%=base.Page.Request["wiid"]%>","<%=HttpContext.Current.Server.UrlEncode(base.Page.Request["ctlid"])%>","<%=base.Page.Request["readonly"]%>",function(res) {
        
            if (tree != null) {
                tree.clear();
            }
            eval(res);
            $("#tree1").ligerTree({
                data: indexdata,
                checkbox: false,
                slide: false,
                childIcon: 'leaf',
                treeLine: false,
                attribute: ['nodename', 'url', 'resid'],
                onSelect: function(node) {
                    if (node.data == null || !node.data.url) return;
                    var tabid = $(node.target).attr("tabid");
                    if (!tabid) {
                        tabid = node.data.text + "_" + node.data.resid;
                        $(node.target).attr("tabid", tabid)
                    }
                    f_addTab(tabid, node.data.text, node.data.url);
                }
            });
            tree = $("#tree1").ligerGetTreeManager();
        }, function(res) {
            alert("树资源加载失败！");
        }, false);
    }
    function Initcy() {
         
        tree.selectNode(function(data) {
             return data.treedataindex == 0;
        });
    }
    function f_heightChanged(options) {
        if (tab)
            tab.addHeight(options.diff);
        if (accordion && options.middleHeight - 24 > 0)
            accordion.setHeight(options.middleHeight - 24);
    }
    function f_addTab(tabid, text, url) {
        tab.addTabItem({ tabid: tabid, text: text, url: url });
    }
    function t_selectNode(tabid) {
        if (tree.getSelected() != null) {
            $(">div:first", $("li[tabid=" + $(tree.getSelected().target).attr("tabid") + "]", tree.tree)).removeClass("l-selected");
        }
        $(">div:first", $("li[tabid=" + tabid + "]", tree.tree)).addClass("l-selected");
    }
    function openDialog(url) {
        dialog = $.ligerDialog.open({ height: 400, width: 600, url: url });
    }
    function closeDialog() {
        if (dialog != null) {
            dialog.close();
        }
    }
    function reloadandclose() {
        closeDialog();
        window.opener.location.href = 'Transactbusiness.aspx';
        window.opener = null; window.open("", "_self"); window.close();
    }
</script>

<script>

    function SaveAll() {
        if (tab.getSelectedTabItemID() != undefined) {
            var contentwin = $("#" + tab.getSelectedTabItemID())[0].contentWindow;
            if (typeof contentwin.SaveAll == "function") {
                contentwin.SaveAll(true);
            }
        }
    }
    function BeforeSubmit() {
        var ctlid = escape('<%=base.Page.Request["ctlid"]%>');
        var url = 'WorkFlowBeforeSubmit.aspx?iid=<%=base.Page.Request["iid"]%>&wiid=<%=base.Page.Request["wiid"]%>&ctlid=' + ctlid;
        openDialog(url);
    }

    function Print() {
        var iid = tab.getSelectedTabItemID();
        var docid = "#framecenter #" + iid;
        $(docid)[0].contentWindow.focus();
        $(docid)[0].contentWindow.print();
    }
    function AttachResource() {
        var optype = '<%=System.Configuration.ConfigurationManager.AppSettings["WorkFlowFileOperationType"]%>';
        if (optype == 0) {/*普通方式*/
            var url = "";
            window.open(url);
        } else {
            var url = 'workflowworkitem.aspx?wiid=<%=base.Page.Request["wiid"]%>&iid=<%=base.Page.Request["iid"]%>&input_index=0&userid=<%=base.Page.Session["userid"]%>&ctlid=<%=base.Page.Request["ctlid"]%>&wid=<%=base.Page.Request["wid"]%>&act=AttachResource';
            f_addTab("addattach", "上传附件", url);
            if (tab.getSelectedTabItemID() != undefined) {
                var contentwin = $("#" + tab.getSelectedTabItemID())[0].contentWindow;
                if (typeof contentwin.AttachResource == "function") {
                    contentwin.AttachResource();
                }
            }
        }
    }
    function AttachResource2() {
        var url = 'WorkFlowFiles.aspx?iid=<%=base.Page.Request["iid"]%>&wiid=<%=base.Page.Request["wiid"]%>&ctlid=' + escape('<%=base.Page.Request["ctlid"]%>') + '&userid=<%=base.Page.Session["userid"]%>&wid=<%=base.Page.Request["wid"]%>&act=AttachResource&rd=' + Math.random();
        $.ligerDialog.open({ height: 530, width: 535, url: url, title: '附件上传' });
    }
    function rollback() {
        var ctlid = escape('<%=base.Page.Request["ctlid"]%>');
        openDialog('Rollback.aspx?iid=<%=base.Page.Request["iid"]%>&wiid=<%=base.Page.Request["wiid"]%>&ctlid=' + ctlid);
    }
    function stop() {
        var ctlid = escape('<%=base.Page.Request["ctlid"]%>');
        openDialog('StopInstance.aspx?iid=<%=base.Page.Request["iid"]%>&wiid=<%=base.Page.Request["wiid"]%>&ctlid=' + ctlid);
    }
    function DelResource() {
        var url = 'FileList.aspx?iid=<%=base.Page.Request["iid"]%>&wiid=<%=base.Page.Request["wiid"]%>&ctlid=' + escape('<%=base.Page.Request["ctlid"]%>') + '&rd=' + Math.random();
        $.ligerDialog.open({ height: 420, width: 620, url: url, title: '附件删除' });
    }
    function zoomin()
    {
        var contentwin = $("#" + tab.getSelectedTabItemID())[0].contentWindow;
        if (contentwin!=null)
        {
            var imgpage = contentwin.document.firstChild.document.getElementById("ctl00_MainerRegion_WorkFlowResourceSkin___fjimg");
            if (imgpage!=null)
            {
                contentwin.Zoomin();
            }
        }
    }
    function zoomout()
    {
        var contentwin = $("#" + tab.getSelectedTabItemID())[0].contentWindow;
        if (contentwin!=null)
        {
            var imgpage = contentwin.document.firstChild.document.getElementById("ctl00_MainerRegion_WorkFlowResourceSkin___fjimg");
            if (imgpage!=null)
            {
                contentwin.Zoomout();
            }
        }
    }
    window.onload = function aa() { ii();};
    function ii() {
        antuajax.WorkFlowHandlerSkin.getRemark("<%=base.Page.Request["iid"]%>","<%=base.Page.Request["wiid"]%>","<%=HttpContext.Current.Server.UrlEncode(base.Page.Request["ctlid"])%>","<%=base.Page.Request["readonly"]%>","<%=base.Page.Request["isback"]%>",function(res) {
            if (res != null && res != ''&&res!='undefinded') { alert('回退意见：' + res); }
        }, function(res) {
            
        }, false);
    }
</script>

<div style="height: 60px">
    <table cellspacing="0" cellpadding="0" width="100%" class="workflowtop" background="<%= Antu.Core.Components.SiteSettings.DefaultSiteSettings.ThemeFolderMapPath %>Default/images/top_bg.jpg"
        border="0">
        <tr style="height: 60px">
            <td style="text-align: center; width: 20px">
                &nbsp;
            </td>
            <td style="text-align: center; width: 50px">
                <img onclick='f_addTab("jdshitu","进度视图","<%=System.Configuration.ConfigurationManager.AppSettings["WorkFlowService"]  %>/HtmlPage/ViewWorkflowProcess.aspx?iid=<%=base.Page.Request["iid"]%>");'
                    src="<%= Antu.Core.Components.SiteSettings.DefaultSiteSettings.ThemeFolderMapPath %>Default/Images/Icons/jindu.png" />
                <br />
                进度视图
            </td>
            <td style="text-align: center; width: 50px">
                <img onclick='f_addTab("gisshitu","GIS视图","<%=System.Configuration.ConfigurationManager.AppSettings["WorkFlowService"]  %>/HtmlPage/ViewWorkflowProcess.aspx?iid=<%=base.Page.Request["iid"]%>");'
                    src="<%= Antu.Core.Components.SiteSettings.DefaultSiteSettings.ThemeFolderMapPath %>Default/Images/Icons/jindu.png" />
                <br />
                GIS视图
            </td>
            <td style="text-align: center; width: 50px">
                <img onclick="Print()" src="<%= Antu.Core.Components.SiteSettings.DefaultSiteSettings.ThemeFolderMapPath %>Default/Images/Icons/print.png" />
                <br />
                打印
            </td>
            <%--<td style="text-align: center; width: 50px">
                <img src="<%= Antu.Core.Components.SiteSettings.DefaultSiteSettings.ThemeFolderMapPath %>Default/Images/Icons/print.png" />
                <br />
                打印预览
            </td>
         <td style="text-align: center; width: 50px">
                <img src="<%= Antu.Core.Components.SiteSettings.DefaultSiteSettings.ThemeFolderMapPath %>Default/Images/Icons/print.png" />
                <br />
                套打
            </td>
            <td style="text-align: center; width: 50px">
                <img src="<%= Antu.Core.Components.SiteSettings.DefaultSiteSettings.ThemeFolderMapPath %>Default/Images/Icons/print.png" />
                <br />
                套打预览
            </td>
            <td style="text-align: center; width: 50px">
                <img src="<%= Antu.Core.Components.SiteSettings.DefaultSiteSettings.ThemeFolderMapPath %>Default/Images/Icons/print.png" />
                <br />
                打印设置
            </td>--%>
            <%if (Antu.Utilities.UtilitiesPage.GetStringPar("readonly", "").ToLower() == "true")
              { }
              else
              { %>
            <td style="text-align: center; width: 50px;">
                <img onclick="AttachResource2()" src="<%= Antu.Core.Components.SiteSettings.DefaultSiteSettings.ThemeFolderMapPath %>Default/Images/Icons/fujianadd.png" />
                <br />
                上传附件
            </td>
            <%--<td style="text-align: center; width: 50px">
                <img src="<%= Antu.Core.Components.SiteSettings.DefaultSiteSettings.ThemeFolderMapPath %>Default/Images/Icons/fujianedit.png" />
                <br />
                更改附件
            </td>--%>
            <td style="text-align: center; width: 50px">
                <img onclick="DelResource()" src="<%= Antu.Core.Components.SiteSettings.DefaultSiteSettings.ThemeFolderMapPath %>Default/Images/Icons/fujiandel.png" />
                <br />
                删除附件
            </td>
            <td style="text-align: center; width: 50px">
                <img onclick="rollback()" src="<%= Antu.Core.Components.SiteSettings.DefaultSiteSettings.ThemeFolderMapPath %>Default/Images/Icons/back.png" />
                <br />
                回退
            </td>
            <td style="text-align: center; width: 50px">
                <img onclick="stop()" src="<%= Antu.Core.Components.SiteSettings.DefaultSiteSettings.ThemeFolderMapPath %>Default/Images/Icons/stop.png" />
                <br />
                中止
            </td>
            <td style="text-align: center; width: 50px">
                <img onclick="SaveAll()" src="<%= Antu.Core.Components.SiteSettings.DefaultSiteSettings.ThemeFolderMapPath %>Default/Images/Icons/save.png" />
                <br />
                保存
            </td>
            <td style="text-align: center; width: 50px">
                <img onclick="BeforeSubmit()" src="<%= Antu.Core.Components.SiteSettings.DefaultSiteSettings.ThemeFolderMapPath %>Default/Images/Icons/next.png" />
                <br />
                提交 
            </td>
            <td style="text-align: center; width: 50px">
                <img alt="" onclick="zoomin()" src="<%= Antu.Core.Components.SiteSettings.DefaultSiteSettings.ThemeFolderMapPath %>Default/Images/Icons/top_ico_09.gif" />
                <br />
                放大
            </td>
            <td style="text-align: center; width: 50px">
                <img alt="" onclick="zoomout()" src="<%= Antu.Core.Components.SiteSettings.DefaultSiteSettings.ThemeFolderMapPath %>Default/Images/Icons/top_ico_08.gif" />
                <br />
                缩小
            </td>
            <%} %>
            <td style="text-align: center;">
                &nbsp;
            </td>
        </tr>
    </table>
</div>

<script>
    var isexpandall = false;
    function checktogger() {
        alert("a");
    }
</script>

<div id="layout1" style="width: 99.2%; margin: 0 auto; margin-top: 4px;">
    <div position="left" title="所有资源" id="accordion1">
        <ul id="tree1" style="margin-top: 3px;" />
    </div>
    <!--startprint-->
    <div position="center" id="framecenter">
    
    
    </div>
    <!--endprint-->
    
</div>

<script type="text/javascript">
    function preview() {
        pagesetup_null();
        bdhtml = window.document.body.innerHTML;
        sprnstr = "<!--startprint-->";
        eprnstr = "<!--endprint-->";
        prnhtml = bdhtml.substr(bdhtml.indexOf(sprnstr) + 17);
        prnhtml = prnhtml.substring(0, prnhtml.indexOf(eprnstr));
        window.document.body.innerHTML = prnhtml;

        window.print();
    }
    var hkey_root, hkey_path, hkey_key;
    hkey_root = "HKEY_CURRENT_USER";
    hkey_path = "\\Software\\Microsoft\\Internet Explorer\\PageSetup\\";
    /*设置网页打印的页眉页脚为空*/
    function pagesetup_null() {
        try {
            var RegWsh = new ActiveXObject("WScript.Shell");
            hkey_key = "header";
            RegWsh.RegWrite(hkey_root + hkey_path + hkey_key, "");
            hkey_key = "footer";
            RegWsh.RegWrite(hkey_root + hkey_path + hkey_key, "");
        } catch (e) { }
    }
		</script>